﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dotNetInteropPlugin.PluginDev;

namespace ManagedTestPlugin2
{
    public partial class LanguageTestForm : Form
    {
        public LanguageTestForm()
        {
            InitializeComponent();
        }

        public IMAIMPPlayer player
        {
            get;set;
        }

        public void Initialize(IMAIMPPlayer pl)
        {
            player = pl;
            lblLang.Text = player.LanguageManager.GetCurrentLanguage();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            lblLang.Text = player.LanguageManager.GetCurrentLanguage();
            if (!player.LanguageManager.IsSectionExist(textBox1.Text))
            {
                textBox3.Text = "";
                lblSpec.Text = "нет секции";
                return;
            }

            string v = player.LanguageManager.ReadValueString(textBox1.Text, textBox2.Text);
            if (v != null)
            {
                textBox3.Text = v;
                lblSpec.Text = "OK";
            }
            else
            {
                textBox3.Text = "";
                lblSpec.Text = "не найдено";
            }
        }
    }
}
